function [  ] = clearZIdMat( this, obj )
% DataPartition::clearZIdMat( this:DataPartition, 
%                             obj :{double, DataMatrix, DataSet}
%              >>           [  ]
% 
% Description
% Clear (set to falses) all the index matrice
% I.e., $.z[Seen,Unsn,Trn,Val,Tst]IdMat$
% Note that this function MUST rely on $obj$
% 
% Input
% 1. this : @DataPartition object
% 2. obj : an object containing the label matrix $Y$
% 
% Output
% 0. 
% 
% Syntax
% ~. this.clear(obj);
% 
% Example
% ~. dataPartition.clear(Y); % $Y$ is a double type label matrix
% ~. dataPartition.clear(dmY); % $dmY$ is a @DataMatrix object
% ~. dataPartition.clear(ds); % $ds$ is a @DataSet object

%% Check input

if nargin == 1
    error('BatErr: Invalid input arguments.');
end

if nargin == 2
    if isa(obj, 'double')
        % obj -> Y:double
        nObs = size(obj, 1);
    end
    if isa(obj, 'DataMatrix')
        % obj -> dmY:DataMatrix
        nObs = obj.nRow;
    end
    if isa(obj, 'DataSet')
        % obj -> ds:DataSet
        nObs = obj.nObs;
    end 
end

%%

nRep = this.nRep;
nFld = this.nFld;
nSubFld = this.nFld;

%%

% Clear $z[Seen,Unsn]IdMat$ according to the size of $Y$
zSeenIdMat = cell(1, nRep);
mat = false(nFld, nObs);
for iRep = 1:nRep
    zSeenIdMat{iRep} = mat;
end
zUnsnIdMat = zSeenIdMat;

% Clear $z[Trn,Val,Tst]IdMat$ according to the size of $Y$
zTrnIdMat = cell(1, nRep);
mat = false(nSubFld, nObs);
for iRep = 1:nRep
    zTrnIdMat{iRep} = cell(1, nFld);
    for iFld = 1:nFld
        zTrnIdMat{iRep}{iFld} = mat;
    end
end
zValIdMat = zTrnIdMat;
zTstIdMat = zTrnIdMat;

%%

this.zSeenIdMat = zSeenIdMat;
this.zUnsnIdMat = zUnsnIdMat;
this.zTrnIdMat = zTrnIdMat;
this.zValIdMat = zValIdMat;
this.zTstIdMat = zTstIdMat;

end
